package com.centerm.structure.dto;

import java.util.ArrayList;
import java.util.List;

import com.centerm.structure.domain.Department;

public class DepartmentTreeInfo {
	private String nodeId; // 用于唯一标识树节点
	private Integer id;
	private String name;
	private Integer isDepartment;// 0:表是用户 1:表示部门
	private Integer manager;
	private Integer isManager; //是否管理员，默认0:否，1是
	private Integer parentId;
	private String description;
	private List<DepartmentTreeInfo> children = new ArrayList<>();;

	public DepartmentTreeInfo(Department department) {
		this.id = department.getId();
		this.name = department.getName();
		//1表示部门，0表示用户
		this.isDepartment = 1;
		this.isManager = 0;
		this.parentId = department.getParentId();
		this.description = department.getDescription();
		this.manager = department.getManager();
		this.setNodeId(isDepartment + "_" + department.getId());
	}
	
	public DepartmentTreeInfo(UserInfo userInfo) {
		this.id = userInfo.getId();
		this.name = userInfo.getName();
		//0表示用户，1表示部门
		this.isDepartment = 0;
		//0标识普通用户，1表示管理员
		this.isManager = userInfo.getIsManager();
		this.parentId = userInfo.getDepartment();
		this.description = userInfo.getDescription();
		this.setNodeId(isDepartment + "_" + userInfo.getId());
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<DepartmentTreeInfo> getChildren() {
		return children;
	}

	public void setChildren(List<DepartmentTreeInfo> children) {
		this.children = children;
	}

	public String getNodeId() {
		return nodeId;
	}

	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public Integer getIsDepartment() {
		return isDepartment;
	}

	public void setIsDepartment(Integer isDepartment) {
		this.isDepartment = isDepartment;
	}

	public Integer getIsManager() {
		return isManager;
	}

	public void setIsManager(Integer isManager) {
		this.isManager = isManager;
	}

	public Integer getManager() {
		return manager;
	}

	public void setManager(Integer manager) {
		this.manager = manager;
	}
}
